package com.domcer.ultra.menu.common.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author Sensen
 * @Date 2025/1/31 17:41
 */
public class FormatUtil {
    public static String[] parse(String action) {
        if ((!action.contains("[")) && (!action.contains("]"))) {
            return new String[]{"", action};
        }

        Pattern pattern = Pattern.compile("\\[(.*?)\\]\\s*(.*)");
        Matcher matcher = pattern.matcher(action);
        if (matcher.matches()) {
            return new String[]{matcher.group(1), matcher.group(2)};
        }
        return null;
    }
}
